using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using HengTong.Model.Db.SupplyChain.Warehouse;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.SupplyChain.Material;

/// <summary>
/// 物料SKU信息表
/// 用于管理具体的物料规格和库存单位
/// </summary>
public class SysMaterialSku : BasePoco
{
    /// <summary>
    /// 物料名称
    /// </summary>
    [Display(Name = "名称", Description = "物料名称")]
    [Required]
    [StringLength(512, ErrorMessage = "{0}长度不能超过{1}")]
    public string Name { get; set; }

    /// <summary>
    /// 物料唯一编码，用于系统内标识物料
    /// </summary>
    [Display(Name = "编码", Description = "物料唯一编码，用于系统内标识物料")]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string Code { get; set; }

    /// <summary>
    /// ERP系统ID，与外部ERP系统同步时使用的标识符
    /// </summary>
    [Display(Name = "ERP系统ID", Description = "与外部ERP系统同步时使用的标识符")]
    [StringLength(64, ErrorMessage = "{0}长度不能超过{1}")]
    public string ErpId { get; set; }
    
    [Display(Name = "ERP物料名称", Description = "ERP系统中的物料名称")]
    [StringLength(512)]
    public string ErpName { get; set; }
    
    [Display(Name = "ERP物料型号", Description = "ERP系统中的物料型号")]
    [StringLength(1024)]
    public string ErpModel { get; set; }

    /// <summary>
    /// 物料详细描述信息
    /// </summary>
    [Display(Name = "详情", Description = "物料详细描述信息")]
    [StringLength(1024, ErrorMessage = "{0}长度不能超过{1}")]
    public string Description { get; set; }
    
    /// <summary>
    /// 物料当前状态（启用/禁用等）
    /// </summary>
    [Display(Name = "状态", Description = "物料当前状态（启用/禁用等）")]
    public CommonState State { get; set; }
    
    /// <summary>
    /// 物料条形码，用于扫码识别
    /// </summary>
    [Display(Name = "条形码", Description = "物料条形码，用于扫码识别")]
    [StringLength(32, ErrorMessage = "{0}长度不能超过{1}")]
    public string BarCode { get; set; }
    
    /// <summary>
    /// 最近一次采购或销售的含税单价
    /// </summary>
    [Display(Name = "含税单价", Description = "最近一次采购或销售的含税单价")]
    [Column(TypeName = "decimal(28,16)")]
    public decimal TaxPrice { get; set; }

    /// <summary>
    /// 最近一次采购或销售的不含税单价
    /// </summary>
    [Display(Name = "单价", Description = "最近一次采购或销售的不含税单价")]
    [Column(TypeName = "decimal(28,16)")]
    public decimal Price { get; set; }
    
    /// <summary>
    /// 物料最近一次入库的时间
    /// </summary>
    [Display(Name = "最近入库时间", Description = "物料最近一次入库的时间")]
    public DateTime? LastInStockTime { get; set; }
    
    /// <summary>
    /// 计量单位ID，外键关联到计量单位表
    /// </summary>
    [Display(Name = "计量单位ID", Description = "计量单位ID")]
    public Guid? UnitId { get; set; }
    
    /// <summary>
    /// 物料计量单位信息（导航属性）
    /// </summary>
    [Display(Name = "计量单位", Description = "物料计量单位信息")]
    public SysMeasureUnit Unit { get; set; }
    
    /// <summary>
    /// 所属物料ID，外键关联到物料表
    /// </summary>
    [Display(Name = "物料ID", Description = "所属物料ID")]
    public Guid? MaterialId { get; set; }
    
    /// <summary>
    /// 所属物料信息（导航属性）
    /// </summary>
    [Display(Name = "物料", Description = "所属物料信息")]
    public SysMaterial Material { get; set; }
    
    /// <summary>
    /// SKU属性列表（导航属性）
    /// </summary>
    [Display(Name = "属性列表", Description = "SKU属性列表")]
    public List<SysMaterialSkuAttributes> Attributes { get; set; }
    
    /// <summary>
    /// 备注
    /// </summary>
    [Display(Name = "备注", Description = "计量单位组的备注信息")]
    [StringLength(256)]
    public string Remark { get; set; }
}